﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Admin.Model
{
    public class ResultModel
    {
        public ResultModel()
        {
        }

        public ResultModel(ResultCodeEnum code, string msg)
        {
            Code = code;
            Msg = msg;
        }

        /// <summary>
        /// 返回码 1=操作成功 负数=有错误 具体错误代码参考ResultCodeEnum1 
        /// </summary>
        public ResultCodeEnum Code { get; set; } = ResultCodeEnum.Fail;

        /// <summary>
        /// 返回信息
        /// </summary>
        public string Msg { get; set; } = "操作失败，请重试";

    }

    public class InfoModel : ResultModel
    {
        public InfoModel()
        {
        }

        public InfoModel(ResultCodeEnum code, string msg, object info)
        {
            Code = code;
            Msg = msg;
            Info = info;
        }

        /// <summary>
        /// 返回信息
        /// </summary>
        public object Info { get; set; }
    }

    /// <summary>
    /// 带泛型实体
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class InfoModel<T> : ResultModel
    {
        public InfoModel()
        {
        }

        public InfoModel(ResultCodeEnum code, string msg, T info)
        {
            Code = code;
            Msg = msg;
            Info = info;
        }

        /// <summary>
        /// 返回信息
        /// </summary>
        public T Info { get; set; }
    }

    public class ListModel : ResultModel
    {
        public ListModel()
        {
        }

        public ListModel(ResultCodeEnum code, string msg, object list)
        {
            Code = code;
            Msg = msg;
            List = list;
        }

        /// <summary>
        /// 返回信息
        /// </summary>
        public object List { get; set; }
    }

    /// <summary>
    /// 带泛型实体
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ListModel<T> : ResultModel
    {
        public ListModel()
        {
        }

        public ListModel(ResultCodeEnum code, string msg, T list)
        {
            Code = code;
            Msg = msg;
            List = list;
        }

        /// <summary>
        /// 返回信息
        /// </summary>
        public T List { get; set; }
    }
}
